Has this instance been initialized?
Adds const
Adds immutable
Casts class to a more generic type
Unsafe-ish dynamic cast, check if is null!
Casts a basic type to a similar (aka same sized) type
Casts an array of classes to a more generic class type
Casts an array of structs or basic types to a similar (aka same sized) type
Constructs managed!T where T is a class
Constructs managed!T where T is a struct or basic type
Constructs managed!T where T is an array with elements of class/struct/basic types
Constructs managed!T where T is a pointer to a class/struct/array/basic type
Constructs managed!T where T is a struct or class type with arguments
IMemoryManager, ISharedMemoryManager, managers, ReferenceCountedManager, NeverDeallocateManager
Implements a managed memory model representation for heap allocated data.
Ensures all memory allocated is accessed in a safe manner but may result in unsafe data usage.
Original concept was for language support link.
This can be thought of in terms of c++ const which is a head only const. A head const is where the pointer may not not change but the data is modifiable. For example an element in array may be changed but it may not be changed to another array.
Compatibility with allocators are a requirement, using IAllocator to represent it. This is a optional element and will by default use theAllocator(). This allows fine grain control over how it allocates on the heap.
When using a COM object as the source, it will assume the responsiblity of AddRef and Releaseing instead of opInc + opDec. Ensuring deallocation when all references are removed. Rule: has secondary ownership and will not attempt to deallocate. But may deallocate at any time.
A managed type is compatible with @safe, "@nogc" and nothrow. However only on the type being represented all of the methods upon managed!T itself is @trusted because of how allocators work.
You may not cast away managed!T or get the real instance of the type. For classes you may cast to a more generic interface/class but not to a more specialised one. For basic types it may be done to another if its size is the same. If the usage will not escape it may be freely used as the real type without casting.
When the managed type is an array, it will wrap all slice actions into returning a managed!T value. This means that all slices are always safe to use and will keep the entirety of the array around until dealloation. Otherwise in normal operations it will act as if it was a normal D array only using allocators for expanding and shrinking.
To retrieve a null version, just use (managed!T).init. It will directly compare to null as true. Since internally it will be comparing to a pointer while using is.